<template>
  <div></div>
</template>

<script setup>
import { JsonRpcProvider, formatEther, Contract, BrowserProvider } from 'ethers';
const provider = new JsonRpcProvider(import.meta.env.VITE_INFURA_LOCAL);
// const provider = new BrowserProvider(window.ethereum);
async function main() {
  const abiERC20 = ['function balanceOf(address) external view returns (uint256);'];
  const addressDAI = '0x5FC8d32690cc91D4c39d9d3abcBD16989F875707'; // DAI Contract
  const contractDAI = new Contract(addressDAI, abiERC20, provider);

  let signer = await provider.getSigner();
  const contractWithSigner = contractDAI.connect(signer);
  const tx = await contractWithSigner.balanceOf('0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266');
  // console.log("Transaction:", tx);
  console.log(provider, signer, '222', contractWithSigner);
}
main();
</script>

<style lang="scss" scoped></style>
